<template>
    <div class="container-fluid main-box preview-mode">
        <div class="row">
            <Main></Main>
            <Preview></Preview>
        </div>
    </div>
</template>
<style>
    .container-fluid [class*=col]:first-child {
        margin-left: 0;
    }

    li {
        line-height: 20px;
    }
    a {
        color: #555555;
        text-decoration: none;
    }
</style>
<script>
    import {writeArticle} from '../../vuex/actions'
    import Main from './main.vue'
    import Preview from './preview.vue'


    export default{
        route:{
            data({to:{params:{id}}}){
                let article = this.articleList.filter(item=>{
                    return item._id == id
                })
                this.writeArticle({id:id,title:article[0].title,content:article[0].content})
            }
        },
        components:{
            Main,
            Preview
        },
        vuex:{
            getters:{
                articleList: ({articleList}) => articleList.items,
            },
            actions:{
                writeArticle
            }
        }

    }
</script>
